package pattern.observer.jdk;

/**
 * @author juxiaojun
 * @since 2019-05-09
 */
public class JDKObserverTest {
    public static void main(String[] args) {
        Learner learner = Learner.getInstance();
        Teacher tom = new Teacher("Tom");
        Teacher mic = new Teacher("Mic");


        //这为没有@Tom老师
        Question question = new Question();
        question.setUserName("小明");
        question.setContent("观察者设计模式适用于哪些场景？");
        learner.addObserver(tom);
        learner.addObserver(mic);
        learner.publishQuestion(question);
    }
}
